#version 300 es

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;

out vec4 outColor;

float plot(vec2 st, float pct){
  return smoothstep(pct - 0.02, pct, st.y) -
        smoothstep(pct, pct+0.02, st.y);
}

void main()
{
  float solution = min(u_resolution.x, u_resolution.y);
  vec2 st = (gl_FragCoord.xy - u_resolution / 2.0) / solution;
  vec2 s = vec2(1.0, 1.0) - step(0.5, abs(st)); 
  if(s.x * s.y < 0.00001){
    discard;
  }
  st = st + vec2(0.5, 0.5);

  float y = pow(st.x, 5.0);
  vec3 color = vec3(y);
  float pct = plot(st, y);
  color = (1.0 - pct)*color + pct * vec3(0.0, 1.0, 0.0);

  outColor = vec4(color, 1);
}